package work.huangxin.share.constant;

import lombok.Data;

/**
 * @author 季台星
 * @Date 2023 03 22 19 20
 * 存储redisKey的常量
 */
@Data
public class RedisConstant {
    public static final String articlePage = "article_page:";
    public static final String articleById = "article_by_Id:";

    public static final String userTokenInRedis = "token:user:";
    //系统模块 邮件账户key前缀
    public static final String SYS_MAIL_ACCOUNT = "sys_mail_account:";
    //当前系统黑名单ip
    public static final String BLACK_LIST_IP = "black_list_ip:";
    //当前正在使用系统的ip
    public static final String USING_SYS_IP = "using_sys_ip:";

    public static final String USER_LIKE_ARTICLE = "users:like:article:";
    public static final String USER_LIKE_TIME = "users:like:time:";

    public static final String USER_BLOCK_LIST = "users:block:list:";

    public static final String GOOD_BY_ID = "goods:get:id";
    public static final String GOOD__PAGE_NO = "goods:index:pageNum:";

    /**
     * 盲盒常量
     */
    public static final String MANHE_INFO = "MANHE:INFO:";
    public static final String MANHE_INFO_COUNT = "MANHE:INFO:COUNT";
    public static final String MANHE_USERS_GET = "MANHE:USERS:GET:";
    public static final String MANHE_USERS_ADD = "MANHE:USERS:ADD:";


    /**
     * 获得随机秒，防止缓存雪崩
     * @return
     */
    public static int getRandomSecond(){
        int second = (int) (System.currentTimeMillis() % 10);
        return second;
    }
}
